package com.teame.readbaby.application;


import java.util.LinkedList;
import java.util.List;

import android.app.Activity;
import android.app.Application;
import android.content.Context;

public class MyApplication extends Application {
	private static MyApplication application;
	private List<Activity> activityList = new LinkedList<Activity>();
	public static Context mContext ;

	// 获取唯一实例对象
	public static MyApplication getAppInstance() {
		if (application == null) {
			application = new MyApplication();
		}
		return application;
	}

	// 添加Activity到容器中
	public void addActivity(Activity activity) {
		activityList.add(activity);
	}
	// 遍历所有Activity并finish
	public void exit() {
		for (Activity activity : activityList) {
			if (activity != null) {
				activity.finish();
			}
		}
		System.exit(0); // 关闭JVM
	}
}

